package com.jy.controller;


import com.jy.entity.CwLsparking;
import com.jy.entity.CwParking;
import com.jy.entity.PageInfo;
import com.jy.entity.R;
import com.jy.service.ICwParkingService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 车位费 前端控制器
 * </p>
 *
 * @author WeiQuan
 * @since 2022-11-14
 */
@RestController
@RequestMapping("/parking")
public class CwParkingController {

//    @Autowired
    @Resource
    private ICwParkingService IC;
//  查询车位费
    @GetMapping("/cwf")
    public R cwf(PageInfo pageInfo){
        System.out.println("=========   ==="+pageInfo.toString());
        PageInfo pageInfo1 = IC.allCwParking(pageInfo);
        return R.result(pageInfo1);
    }
//    添加车位费
    @PostMapping("/addcwf")
    public R addcwf(@RequestBody CwParking cwParking){
        int cwf = IC.addcwparking(cwParking);
        return R.result(cwf);
    }
    //    删除车位费
    @GetMapping("/delcwf/{pid}")
    public R delcwf(@PathVariable("pid") Integer pid){
        int fid = IC.delcwparking(pid);
        return R.result(fid);
    }
    //    修改车位费
    @PostMapping("/upcwf")
    public R upcwf(@RequestBody CwParking cwParking){
        int cwf = IC.upcwparking(cwParking);
        return R.result(cwf);
    }

}
